package br.edu.ufcg.unknown.exception;

import br.edu.ufcg.unknown.lexico.Token;

public class AnalisadorLexicoUnknownRuntimeException extends UnknownRuntimeException {

	/**
	 * Token problemático.
	 */
	private Token token;

	/**
	 * Caractere problemático.
	 */
	private Character caractere;

	private int linha;

	private int coluna;

	/**
	 * 
	 */
	private static final long serialVersionUID = 4891149674574830068L;

	private AnalisadorLexicoUnknownRuntimeException(String mensagem, Throwable e, Token token) {
		super(mensagem, e);
		this.token = token;
	}

	private AnalisadorLexicoUnknownRuntimeException(String mensagem, Throwable e, Character caractere) {
		super(mensagem, e);
		this.caractere = caractere;
	}

	public AnalisadorLexicoUnknownRuntimeException(String mensagem, Token token) {
		this(mensagem, null, token);
	}

	public AnalisadorLexicoUnknownRuntimeException(String mensagem, Token token, int linha, int coluna) {
		this(mensagem, null, token);
		this.linha = linha;
		this.coluna = coluna;
	}

	public AnalisadorLexicoUnknownRuntimeException(String mensagem, Character caractere) {
		this(mensagem, null, caractere);
	}

	public AnalisadorLexicoUnknownRuntimeException(String mensagem, Character caractere, int linha, int coluna) {
		this(mensagem, null, caractere);
		this.linha = linha;
		this.coluna = coluna;
	}

	public Token getToken() {
		return token;
	}

	public Character getCaractere() {
		return caractere;
	}

	public int getLinha() {
		return linha;
	}

	public int getColuna() {
		return coluna;
	}

	public boolean equals(Object obj) {
		AnalisadorLexicoUnknownRuntimeException e = (AnalisadorLexicoUnknownRuntimeException) obj;

		if (this.token != null && e.token != null) {
			if (!(this.token.equals(e.token))) {
				return false;
			}
		} else if (this.token != null || e.token != null) {
			return false;
		}

		if (this.caractere != null && e.caractere != null) {
			if (!(this.caractere.equals(e.caractere))) {
				return false;
			}
		} else if (this.caractere != null || e.caractere != null) {
			return false;
		}

		return true;
	}

}
